const router = require("koa-router")();
router.get("/login", async ctx => {
    await ctx.render("login")
})
router.get("/doLogin", async ctx => {
    console.log(ctx.query)
    var { username, pwd } = ctx.query;
    if (username == "zong" && pwd == 123) {
        ctx.cookies.set("login", "success");
        await ctx.redirect("/form")
    } else {
        ctx.body = "<script>alert('用户名或密码错误');location.href='/login'</script>"
    }
})
module.exports = router;